<style>
.{{$t|escape:'html'}}_image_button {
  cursor: pointer;
}
table.{{$t|escape:'html'}}_list {
  width: 500px;
  border-left: 1px solid #dddddd;
  border-top: 1px solid #dddddd;
  margin-bottom: 1px;
  font-size: 11px;
}
table.{{$t|escape:'html'}}_list td.border {
  border-right: 1px solid #dddddd;
  border-bottom: 1px solid #dddddd;
}
table.{{$t|escape:'html'}}_list th {
  text-align: left;
  height: 35px;
  background-color: #eaf2f5;
  padding: 5px 0 5px 10px; 
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
  cursor: pointer;
}

table.{{$t|escape:'html'}}_list tr.rowodd td {
  height: 28px;
  background-color: #eeeeee;
  border-right: 1px solid #dddddd;
  border-bottom: 1px solid #dddddd;
  font-size: 11px;
}
table.{{$t|escape:'html'}}_list tr.roweven td {
  height:28px;
  border-right: 1px solid #dddddd;
  border-bottom: 1px solid #dddddd;
  font-size: 11px;
}
</style>

<div>
  <table class="{{$t|escape:'html'}}_list" cellPadding="0" cellSpacing="0" width="500px">
    <tr style="background: #e2ecee">
      <td colSpan=2 style="height: 35px; padding-left: 10px; border-right: solid 1px #ddd; font-size: 11px; font-weight: 600">待处理事务</td>
    </tr>
    <tr class="roweven">
      <td width="200px" style="padding-left: 10px">未付款的订单</td>
      <td width="300px" style="padding-left: 10px" id="{{$t|escape:'html'}}_td1"></td>
    </tr>
    <tr class="rowodd">
      <td width="200px" style="padding-left: 10px">已付款未出货订单</td>
      <td width="300px" style="padding-left: 10px" id="{{$t|escape:'html'}}_td2"></td>
    </tr>
    <tr class="roweven">
      <td width="200px" style="padding-left: 10px">库存不够的产品</td>
      <td width="300px" style="padding-left: 10px" id="{{$t|escape:'html'}}_td3"></td>
    </tr>
    <tr class="rowodd">
      <td width="200px" style="padding-left: 10px">可用产品</td>
      <td width="300px" style="padding-left: 10px" id="{{$t|escape:'html'}}_td4"></td>
    </tr>
    <tr class="roweven">
      <td width="300px" style="padding-left: 10px">不可用产品</td>
      <td width="300px" style="padding-left: 10px;" id="{{$t|escape:'html'}}_td5"></td>
    </tr>
  </table>
</div>

<script src="jsrequest.php?script={{$t|escape:'html'}}" type="text/javascript"></script>
<script type="text/javascript">
  <!--
    if (document.addEventListener) {
      document.addEventListener('DOMContentLoaded', init, false);
    }
    window.onload = init;
    
    var _result = JSON.parse('{{$result|@json_encode|escape:'javascript'}}');
    
    function init() {
      if (!document.getElementById || !document.createElement || !arguments || arguments.callee._loaded) {
        return;
      }
      arguments.callee._loaded = true;
      
      setInformation();
    }
    
    function setInformation() {
      var div1 = document.getElementById("{{$t|escape:'html'}}_td1");
      var div2 = document.getElementById("{{$t|escape:'html'}}_td2");
      var div3 = document.getElementById("{{$t|escape:'html'}}_td3");
      var div4 = document.getElementById("{{$t|escape:'html'}}_td4");
      var div5 = document.getElementById("{{$t|escape:'html'}}_td5");
      
      DOMUtils.removeChildElements(div1);
      DOMUtils.removeChildElements(div2);
      DOMUtils.removeChildElements(div3);
      DOMUtils.removeChildElements(div4);
      DOMUtils.removeChildElements(div5);
      
      if (_result.unpaids > 0) {
        var a1 = document.createElement('a');
        a1.href = '#';
        a1.style.color = '#f39e0d';
        a1.style.textDecoration = 'underline';
        a1.onclick = function() {
          parent.location.href = 'admin.php?path=ecommerce&t=orders&st=1';
        }
        a1.appendChild(document.createTextNode(_result.unpaids));
        div1.appendChild(a1);
      } else {
        div1.appendChild(document.createTextNode(_result.unpaids));
      }
      
      if (_result.unships > 0) {
        var a2 = document.createElement('a');
        a2.href = '#';
        a2.style.color = '#f39e0d';
        a2.style.textDecoration = 'underline';
        a2.onclick = function() {
          parent.location.href = 'admin.php?path=ecommerce&t=orders&st=2';
        }
        a2.appendChild(document.createTextNode(_result.unships));
        div2.appendChild(a2);
      } else {
        div2.appendChild(document.createTextNode(_result.unships));
      }
      
      if (_result.unenough_stocks > 0) {
        var a3 = document.createElement('a');
        a3.href = '#';
        a3.style.color = '#f39e0d';
        a3.style.textDecoration = 'underline';
        a3.onclick = function() {
          parent.location.href = 'admin.php?path=ecommerce&t=products&st=1';
        }
        a3.appendChild(document.createTextNode(_result.unenough_stocks));
        div3.appendChild(a3);
      } else {
        div3.appendChild(document.createTextNode(_result.unenough_stocks));
      }
      
      div4.appendChild(document.createTextNode(_result.avai_pros));
      div5.appendChild(document.createTextNode(_result.unavai_pros));
    }
   // -->
</script>